package com.situ.water_user.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.situ.water_system.mapper.SyAreaMapper;
import com.situ.water_system.pojo.SyArea;
import com.situ.water_user.pojo.UsUser;
import com.situ.water_user.mapper.UsUserMapper;
import com.situ.water_user.service.UsUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Angel
 * @since 2020-12-01
 */
@Service
public class UsUserServiceImpl extends ServiceImpl<UsUserMapper, UsUser> implements UsUserService {
    @Autowired
    private UsUserMapper mapper;
    @Autowired
    UsUserMapper usUserMapper;
    @Autowired
    SyAreaMapper syAreaMapper;



    @Override
    public IPage<UsUser> queryalllwt(Page<UsUser> page, UsUser user) {
        return mapper.selectbylwt(page,user);
    }



    @Override
    public List<UsUser> queryUser(QueryWrapper wrapper) {
        return usUserMapper.selectList(wrapper);
    }

    @Override
    public void addUser(UsUser user) {
        usUserMapper.insert(user);
    }

    @Override
    public List<SyArea> querySyArea() {
        return syAreaMapper.selectList(null);
    }

    @Override
    public Integer userID() {
        return usUserMapper.userID();
    }

    @Override
    public PageInfo pageUser(QueryWrapper wrapper, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<UsUser> ulist = usUserMapper.selectList(wrapper);

        PageInfo pageInfo = new PageInfo<UsUser>(ulist,5);

        return pageInfo;
    }

    @Override
    public UsUser queryByUserNo(String userNo) {
        return usUserMapper.queryByUserNo(userNo);
    }

    @Override
    public UsUser queryOne(QueryWrapper wrapper) {
        return usUserMapper.selectOne(wrapper);
    }

    @Override
    public void ghUser(UsUser user) {
        usUserMapper.ghUser(user);
    }

    @Override
    public void dkUser(UsUser user) {
        usUserMapper.dkUser(user);
    }

    @Override
    public void cqUser(UsUser user) {
        usUserMapper.cqUser(user);
    }

    @Override
    public void xhUser(UsUser user) {
        usUserMapper.xhUser(user);
    }

    @Override
    public void dahUser(UsUser user) {
        usUserMapper.dahUser(user);
    }

}
